import request from '@/utils/request'

export function pageList(queryParams) {
  return request({
    url: 'user/pageList',
    method: 'get',
    params: queryParams
  })
}

export function save(data) {
  return request({
    url: 'user/save',
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: 'user/update',
    method: 'post',
    data
  })
}

export function updatePwd(data) {
  return request({
    url: 'user/updatePwd',
    method: 'post',
    data
  })
}

export function detail(id) {
  return request({
    url: `user/detail/${id}`,
    method: 'get'
  })
}


export function login(data) {
  return request({
    url: 'login',
    method: 'post',
    params: data
  })
}

export function getUserInfo() {
  return request({
    url: 'user/detail/0',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: 'login?logout',
    method: 'get'
  })
}

export function getMyMenuPrivilege() {
  return request({
    url: 'resource/listMy',
    method: 'get'
  })
}

export function exist(params) {
  return request({
    url: "user/exist",
    method: 'post',
    data: {"username": params.username}
  })
}


